package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	SummaryEventNew           = "wms.SummaryNew"
	SummaryEventBeforeCreate  = "wms.SummaryBeforeCreate"
	SummaryEventBeforeUpdate  = "wms.SummaryBeforeUpdate"
	SummaryEventBeforeSave    = "wms.SummaryBeforeCreate wms.SummaryBeforeUpdate"
	SummaryEventAfterCreate   = "wms.SummaryAfterCreate"
	SummaryEventAfterUpdate   = "wms.SummaryAfterUpdate"
	SummaryEventAfterSave     = "wms.SummaryAfterCreate wms.SummaryAfterUpdate"
	SummaryEventDelete        = "wms.SummaryDelete"
	SummaryAccessControlEvent = "wms.SummaryAccessControl"
)

func GetSummaryConfig() *mgo.DocConfig {
	return Summary_Config
}

var Summary_Config *mgo.DocConfig

func init() {
	Summary_Config = NewSummaryConfig()
}
func NewSummaryConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "wms.Summary",
		Fields: []string{
			"item", "itemName", "type", "typeName", "ioType", "ymd", "y", "m", "d", "num", "cost",
		},
		RelationFields: []string{
			"item", "type",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"item": {
				Config:     GetItemSkuConfig,
				DocName:    "ItemSku",
				JoinType:   "O",
				KeyInside:  "itemId",
				KeyOutSide: "id",
			},
			"type": {
				Config:     GetIOTypeConfig,
				DocName:    "IOType",
				JoinType:   "O",
				KeyInside:  "typeId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
